package com.yxh.service.impl;

import com.github.pagehelper.PageInfo;
import com.yxh.base.PageEntity;
import com.yxh.dao.FlowShipMapper;
import com.yxh.pojo.FlowShip;
import com.yxh.service.FlowNodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * Created by WL on 2018/7/23.
 */

@Service
@Transactional
public class FlowNodeServiceImpl implements FlowNodeService {
    @Autowired
    private FlowShipMapper flowShipMapper;

    @Override
    public int save(FlowShip record) {
        int i;
           i=flowShipMapper.insertSelective(record);
        FlowShip f=new FlowShip();
        f.setId(record.getId());
        for(String u:record.getUserId().split(",")){
            f.setUserId(u);
            i= flowShipMapper.insertShip(f);
        }

        return i;
    }

    @Override
    public int update(FlowShip record) {

        int i=flowShipMapper.deleteByPrimaryKey(record.getId());
        FlowShip f=new FlowShip();
        f.setId(record.getId());
        for(String u:record.getUserId().split(",")){
            f.setUserId(u);
            i= flowShipMapper.insertShip(f);
        }
        return i;
    }

    @Override
    public int delete(String id) {
        return 0;
    }

    @Override
    public void batchDelete(List<FlowShip> records) {

    }

    @Override
    public FlowShip get(String id) {
        return null;
    }

    @Override
    public FlowShip get(FlowShip record) {


        return null;
    }

    @Override
    public List<FlowShip> getList(FlowShip record) {

        return null;
    }


    @Override
    public List<Map<String,Object>> getLists(FlowShip record) {

        return flowShipMapper.selectByFlowShip(record);
    }
    @Override
    public List<FlowShip> getAllList(FlowShip record) {
        return null;
    }

    @Override
    public List<FlowShip> getListPage(PageEntity<FlowShip> record) {
        return null;
    }

    @Override
    public PageInfo getInformation(FlowShip record, Integer page, Integer pageSize) {
        return null;
    }
}
